
// === uuMeta.event.base ===
// depend: uuMeta
/*
uuMeta.event.bind(node, eventName, fn, capture)
uuMeta.event.unbind(node, eventName, fn, capture)
uuMeta.event.stop(evt)
 */
(function uuMetaEventBaseScope() {
var _mm = uuMeta,
    _ua = _mm.ua;

// uuMeta.event.bind
function bind(node,      // @param Node:
              eventName, // @param String:
              callback,  // @param Function: callback
              capture) { // @param Boolean(= false):
  _ua.ie ? node.attachEvent("on" + eventName, callback)
         : node.addEventListener(eventName, callback, capture || false);
}

// uuMeta.event.unbind
function unbind(node,      // @param Node:
                eventName, // @param String:
                callback,  // @param Function: callback
                capture) { // @param Boolean(= false):
  _ua.ie ? node.detachEvent("on" + eventName, callback)
         : node.removeEventListener(eventName, callback, capture || false);
}

// uuMeta.event.stop
function stop(evt) { // @param EventObject(= undefined):
  evt = evt || _win.event;
  _ua.ie ? (evt.cancelBubble = true) : evt.stopPropagation();
  _ua.ie ? (evt.returnValue = false) : evt.preventDefault();
}

// --- initialize ---

// --- export ---
_mm.mix(_mm.event, {
  bind:   bind,
  unbind: unbind,
  stop:   stop
});

})(); // uuMeta.event.base scope

